import { createRouter, createWebHashHistory ,createWebHistory} from 'vue-router'

import About from '@/components/About.vue'
import Home from '@/components/Home.vue'
import News from '@/components/News.vue'
import Detail from '@/components/Detail.vue'





const router = createRouter(
    {
        history: createWebHistory(),
        routes: [
            {
                path: '/home',
                component: Home

            },
            {
                path: '/about',
                component: About
            },
            {
                path: '/news',
                component: News,
                children: [
                    {
                        // 子级不需要写/
                        path:"detail",
                        component:Detail
                    }
            ]
            },
            {
                path:"/",
                redirect: "/home"
            }
        ]
    }
)

export default router